<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.HTMLTool"%>
<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="org.limp.mine.Controller"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="jt.classic.system.wordbook.XWordbookMain"%>
<%@ page import="jt.classic.system.wordbook.XWordbookQuery"%>
<%@ page import="jt.classic.system.wordbook.XWordbook"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[]) request.getAttribute("result");
	Label label = (Label) result[1];
	Controller controller = (Controller) result[2];
	String pageNO = (String) result[3];
	List resultList = (List) result[0];
	
	String catid = StringTool.checkString(request.getAttribute("catid"));
	String qname = StringTool.checkString(request.getAttribute("qname"));
	Map cat = (Map)request.getAttribute("cat");
	
	List catList = (List)request.getAttribute("catList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>个人通讯录列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../head.jsp"></jsp:include>
<script>
     function handleSet(m){
         if(m != ""){
            parent.$("phoneNum").value = m;
            parent.closeDialog();
         }else{
            alert("移动电话号码为空，不能发送短信");
         }
     }
     
     function handleSel(thizz){
         window.location.href = context + "/app/addressbook.do?method=select&catid=" + thizz.value;
     }
     
     function handleQuery(){
         document.form1.action = context + "/app/addressbook.do?method=select";
         document.form1.submit();
     }
</script>
<body>
<form name="form1" method="post" action="">
<input type="hidden" name="pageNO" value="<%=pageNO%>">
<table border="0" align="center" width="100%">
<%
		  if(catList != null && !catList.isEmpty()){
		%>
	<tr>
		<td colspan="2" align="right">
		姓名&nbsp;<input type="text" style="width:70px;" name="qname" class="box4" value="<%=qname %>">
		类别&nbsp;
		<select style="width:100px;" name="catid" onChange="javascript:handleSel(this);">
		<%	  
			  for(int i=0;i<catList.size();i++){
				  Map m = (Map)catList.get(i);
				  String selected = catid.equals(m.get("ID")) ? "selected" : "";
		%>
		<option value="<%=m.get("ID") %>" <%=selected %>><%=m.get("CATNAME") %></option>
		<%
		  
			  }
		%>
		</select>
		<a href="javascript:void(0);" onclick="javascript:handleQuery();">查询</a>	
		<!--
<input type="text" style="width:100px;" name="qname" class="box4" value="<%=qname %>">
 <a href="javascript:void(0);" onclick="javascript:handleQuery();">查 询</a>
-->
		</td>
	</tr>
	<%
		  }  
		%>
</table>
<table class="tab4edit" align="center" width="100%">
	<tr>
		<td class="td1" 
			width="50%" align="center">&nbsp;<font color="#4C4C4C">联系人姓名</font></td>
		<td class="td1" 
			width="50%" align="center">&nbsp;<font color="#4C4C4C">移动电话</font></td>
	</tr>
	<%
			if (resultList != null && !resultList.isEmpty()) {
				
			for (int i = 0; i < resultList.size(); i++) {
				Map info = (Map) resultList.get(i);
				String number = (String) info.get("PAGINATION_NUMBER");
				String ID = (String) info.get("ID");
				String NAME = (String) info.get("NAME");
				String OFFICEPHONE = (String) info.get("OFFICEPHONE");
				String OFFICEFAX = (String) info.get("OFFICEFAX");
				String MOBILEPHONE = (String) info.get("MOBILEPHONE");
				String EMAIL = (String) info.get("EMAIL");
				String ADDRESS = (String) info.get("ADDRESS");
				
	%>
	<tr onMouseOver="javascript:this.bgColor='#ffff99'"
		onmouseout=" javascript:this.bgColor='#ffffff'" bgColor="#ffffff">
		<td align="center"><a href="javascript:void(0);" title="点击选择联系人" onclick="javascript:handleSet('<%=MOBILEPHONE %>');"><%=NAME%></a></td>
		<td align="center">&nbsp;<%=MOBILEPHONE%></td>
	</tr>
	<%
		}
		}
	%>
</table>
<table width="100%" class="tab-noborder" align="center" border="0" cellspacing="0"
	cellpadding="0">
	<tr>
		<td><%=label.displayLabel()%></td>
		<td align="right"><%=label.startLabel()%> <%=label.previousLabel()%>
		<%=label.nextLabel()%> <%=label.endLabel()%> <%=controller.getController().toString()%>
		</td>
	</tr>
</table>
<%=controller.getControlScript(true)%></form>
</body>
</html>
